package com.easy;

/**
 * Created by Lxk on 2019/6/8.
 */
public class Solution559 {

    private int getDepth(Node cur){
        if(cur==null){
            return 0;
        }
        int max = 0;
        for(Node node : cur.children){
            int nodeDepth = getDepth(node);
            if(nodeDepth>max){
                max = nodeDepth;
            }
        }
        return max + 1;
    }

    public int maxDepth(Node root) {
        return getDepth(root);
    }

}
